package org.jsets.fastboot.oss.config;

import org.jsets.fastboot.eventbus.EventBus;
import org.jsets.fastboot.oss.service.IBucketService;
import org.jsets.fastboot.oss.service.IFileMetaService;
import org.jsets.fastboot.oss.service.IOutsideService;
import org.jsets.fastboot.oss.service.IStorageConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import lombok.extern.slf4j.Slf4j;

/**
 * RUNNING
 *
 * @author wangjie (https://github.com/wj596)
 * @date 2021.07.12 21:49
 */
@Slf4j
@Component
public class ObjectStorageRunner implements CommandLineRunner {

	@Autowired
	private IStorageConfigService storageConfigService;
	@Autowired
	private IBucketService bucketService;
	@Autowired
	private IOutsideService outsideService;
	@Autowired
	private IFileMetaService fileMetaService;
	
	public void run(String... args) throws Exception {
		this.storageConfigService.initialize();
		this.bucketService.initialize();
		EventBus.register(outsideService);
		EventBus.register(fileMetaService);
		log.info("===========OSS 模块启动完毕============");
	}

}